package com.team3.project.service;

import java.util.List;




import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.team3.project.dao.LeaveDAO;
import com.team3.project.dao.PublicHolidayDAO;
import com.team3.project.dao.UserDAO;
import com.team3.project.exception.LeaveNotFoundException;
import com.team3.project.exception.UserNotFoundException;
import com.team3.project.model.LeaveRecord;
import com.team3.project.model.PublicHolidays;
import com.team3.project.model.Users;


public class LAPServiceImpl implements LAPService {

	
	private LeaveDAO leaveRecordDAO;
	private PublicHolidayDAO publicHolidayDAO;
	private UserDAO userDAO;
	
	public void setLeaveRecordDAO(LeaveDAO leaveRecordDAO) {
		this.leaveRecordDAO = leaveRecordDAO;
	}

	public void setPublicHolidayDAO(PublicHolidayDAO publicHolidayDAO) {
		this.publicHolidayDAO = publicHolidayDAO;
	}

	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}

	
	@Override
	public void save(Users user) {
		userDAO.save(user);
		
	}

	@Override
	public void save(LeaveRecord leaveRecord) {
		leaveRecordDAO.save(leaveRecord);
		
	}

	@Override
	public void save(PublicHolidays publicHolidays) {
		publicHolidayDAO.save(publicHolidays);
		
	}

	@Override
	public void update(Users user) {
		userDAO.update(user);
		
	}

	@Override
	public void update(LeaveRecord leaveRecord) throws LeaveNotFoundException {
		leaveRecordDAO.update(leaveRecord);
		
	}

	@Override
	public void update(PublicHolidays publicHolidays) {
		publicHolidayDAO.update(publicHolidays);
		
	}

	@Override
	public Users findByID(int id) throws UserNotFoundException {
		return userDAO.findByID(id);
	}

	@Override
	public LeaveRecord findByrefNO(int refNO) throws LeaveNotFoundException{
		return leaveRecordDAO.findByRefNo(refNO);
	}

	@Override
	public List<Users> findAllUsers() {
		return userDAO.findAll();
	}

	@Override
	public List<LeaveRecord> findAllLeaveRecords() { 
		return leaveRecordDAO.findAll();
	}

	@Override
	public List<PublicHolidays> findAllPublicHoliday() {
		return publicHolidayDAO.findAll();
	}

	
}
